#include "frozen-bubble.h"

void menu_start_btn_playdefault_press (FBWidget *widget)
{
	game_start_1player ();
}

void menu_start_btn_1pgame_press (FBWidget *widget)
{
	FBWidgetLayer *layer = widget_layer_new (rootlayer);
	
	layer->x = 150;
	layer->y = 100;
	layer->bg = widget_layer_adopt (layer, widget_new_image (IMG_1P_PANEL, 0, 0));
	
	FBWidget *btn_playdefault = widget_new_button (IMG_TXT_MENU_1P_OFF, IMG_TXT_MENU_1P_OVER, 20, 90);
	btn_playdefault->anim_count = get_image_list (IMGTMPLT_BTNTXT_PLAYDEFAULT, 1, 1, btn_playdefault->anim);
	btn_playdefault->on_press = menu_start_btn_playdefault_press;
	widget_layer_append (layer, btn_playdefault);
	
	FBWidget *btn_picklevels = widget_new_button (IMG_TXT_MENU_1P_OFF, IMG_TXT_MENU_1P_OVER, 20, 130);
	btn_picklevels->anim_count = get_image_list (IMGTMPLT_BTNTXT_PICKLEVELS, 1, 1, btn_picklevels->anim);
	widget_layer_append (layer, btn_picklevels);
	
	FBWidget *btn_playrandom = widget_new_button (IMG_TXT_MENU_1P_OFF, IMG_TXT_MENU_1P_OVER, 20, 170);
	btn_playrandom->anim_count = get_image_list (IMGTMPLT_BTNTXT_PLAYRANDOM, 1, 1, btn_playrandom->anim);
	widget_layer_append (layer, btn_playrandom);
	
	FBWidget *btn_mptraining = widget_new_button (IMG_TXT_MENU_1P_OFF, IMG_TXT_MENU_1P_OVER, 20, 210);
	btn_mptraining->anim_count = get_image_list (IMGTMPLT_BTNTXT_MPTRAINING, 1, 1, btn_mptraining->anim);
	widget_layer_append (layer, btn_mptraining);
}

void menu_start ()
{
	FBWidgetLayer *layer = widget_layer_new (NULL);
	
	layer->bg = widget_layer_adopt (layer, widget_new_image (IMG_BACK_START, 0, 0));
	
	FBWidget *logo = widget_new_image (IMG_FBLOGO, 400, 15);
	widget_layer_append (layer, logo);
	
	FBWidget *stamp = widget_new_image (IMG_STAMP, 490, 142);
	widget_layer_append (layer, stamp);
	
	FBWidget *btn_1pgame = widget_new_button (IMG_TXT_1PGAME_OFF, IMG_TXT_1PGAME_OVER, 90, 15);
	btn_1pgame->anim_count = get_image_list (IMGTMPLT_ANIM_1PGAME, 1, 30, btn_1pgame->anim);
	btn_1pgame->anim_x = 160; btn_1pgame->anim_y = 10;
	btn_1pgame->on_press = menu_start_btn_1pgame_press;
	widget_layer_append (layer, btn_1pgame);
	
	FBWidget *btn_2pgame = widget_new_button (IMG_TXT_2PGAME_OFF, IMG_TXT_2PGAME_OVER, 90, 70);
	btn_2pgame->anim_count = get_image_list (IMGTMPLT_ANIM_P1P2, 1, 30, btn_2pgame->anim);
	btn_2pgame->anim_x = 160; btn_2pgame->anim_y = 10;
	widget_layer_append (layer, btn_2pgame);
	
	FBWidget *btn_netgame = widget_new_button (IMG_TXT_NETGAME_OFF, IMG_TXT_NETGAME_OVER, 90, 125);
	btn_netgame->anim_count = get_image_list (IMGTMPLT_ANIM_NETGAME, 1, 89, btn_netgame->anim);
	btn_netgame->anim_x = 160; btn_netgame->anim_y = 10;
	widget_layer_append (layer, btn_netgame);
	
	FBWidget *btn_highscores = widget_new_button (IMG_TXT_HIGHSCORES_OFF, IMG_TXT_HIGHSCORES_OVER, 90, 180);
	btn_highscores->anim_count = get_image_list (IMGTMPLT_ANIM_HIGHSCORE, 1, 89, btn_highscores->anim);
	btn_highscores->anim_x = 160; btn_highscores->anim_y = 10;
	widget_layer_append (layer, btn_highscores);
	
	widget_layer_root (layer);
}

